﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace PhotoBook.Services
{
    public class OpenStoredXmlTransformation : PhotoBook.Model.Services.IOpenStored 
    {

        #region IOpenStored Members

        public PhotoBook.Model.Entities.FotoTransformation OpenTransformation(string file)
        {
            return OpenTransformation(System.IO.File.OpenRead(file));
        }

        public PhotoBook.Model.Entities.FotoTransformation OpenTransformation(System.IO.FileStream stream)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(PhotoBook.Model.Entities.FotoTransformation));
            object objeto = serializer.Deserialize(stream);
            stream.Close();
            return (PhotoBook.Model.Entities.FotoTransformation)objeto;
        }

        #endregion
    }
}
